Hệ thống quản lý trường học bằng PHP / MySQLi

1 <?php
2 error_reporting(
0);
3 include_once(
'connect.php');
4 $payment=$_GET[
'payment'];
5 $sql =
"SELECT `reciept`, `method`, `refno`, `student_id`, `tdate`, `amount` FROM fee WHERE student_id='$payment'";
6 $resultset = mysqli_query($db, $sql) or die(
"database error:". mysqli_error($db));
7 //
get the students details
8 $sql2 =
"SELECT * FROM studentstable WHERE student_id='$payment'";
9 $resultset2 = mysqli_query($db, $sql2) or die(
"database error:". mysqli_error($db));
10 while
($users3=mysqli_fetch_array($resultset2))
11         {
12         $name=$users3[
'sirname']." ".$users3['firstname']." ".$users3['lastname'];
13         $adm=$users3[
'student_id'];
14         $course_id=$users3[
'course_id'];
15         $feepayable=$users3[
'feepayable'];
16         }
17 $sql3 =
"SELECT * FROM course WHERE course_id='$course_id'";
18 $resultset3 = mysqli_query($db, $sql3) or die(
"database error:". mysqli_error($db));
19 while
($users3=mysqli_fetch_array($resultset3))
20         {
21         $coursename=$users3[
'coursename'];
22         }
23
24
25 require(
'fpdf/fpdf.php');
26 class
PDF extends FPDF
27 {

28 // Page header

29 function Header()
30 {
31     
// Logo
32     $
this->Image('logo2.png',10,6,30);
33     
// Arial bold 15
34     $
this->SetFont('Arial','B',15);
35     
// Move to the right
36     $
this->Cell(80);
37     
// Title
38     $
this->Cell(30,10,'Aberdare Institute of Business and Catering',0,0,'C');
39     
// Line break
40     $
this->Ln(20);
41 }

42
43 // Page footer

44 function Footer()
45 {
46     
// Position at 1.5 cm from bottom
47     $
this->SetY(-15);
48     
// Arial italic 8
49     $
this->SetFont('Arial','I',8);
50     
// Page number
51     $
this->Line(0, 600, 210,600);
52     $
this->Cell(0,5,'Page '.$this->PageNo().'/{nb}',0,0,'C');
53 }
54 }
55
56
57 $pdf =
new PDF();
58 $pdf->SetAuthor(
'John Muthama');
59 $pdf->AliasNbPages();

60 //
set font for the entire document
61 $pdf->SetFont(
'Helvetica','B',20);
62 $pdf->SetTextColor(
50,60,100);
63 //
set up a page
64 $pdf->AddPage(
'P');
65 //$pdf->SetDisplayMode(real,
'default');
66 //insert an image and make it a link
67
68 //display the title with a border around it

69 $pdf->SetXY(
50,20);
70 $pdf->SetDrawColor(
50,60,100);
71 $pdf->Cell(
100,10,'Invoice',1,0,'C',0);
72 //C MEANS CENTERED
73 //Set x and y position
for the main text, reduce font size and write content
74 $pdf->SetXY (
10,50);
75 $pdf->SetFontSize(
10);
76
77 //
for($i=1;$i<=40;$i++)
78 // $pdf->Cell(
0,10,'Printing line number '.$i,0,1);
79 $pdf->Cell(
0,10,'Student Name :'.$name ,0,1);
80 $pdf->Cell(
0,10,'Admission Number :'.$adm ,0,1);
81 $pdf->Cell(
0,10,'Course ID :'.$coursename ,0,1);
82
83 //
this are the contact details
84 $pdf->SetXY(
150, 50);
85 $pdf->Cell(
0,10,'P.O Box 1097,',0,1);
86 $pdf->SetXY(
150, 60);
87 $pdf->Cell(
0,10,'Ruiru, Kenya :',0,1);
88 $pdf->SetXY(
150, 70);
89 $pdf->Cell(
0,10,'Tel: 0705016714 :' ,0,1);
90
91 //Put a line here

92 $pdf->Ln(
4); // line Break
93 $pdf->Line(
0, 80, 210, 80); //Set the line
94 $pdf->Ln(
4); //line Break
95
96 while
($field_info = mysqli_fetch_field($resultset)) {
97 $pdf->Cell(
32,12,$field_info->name,1);
98 }

99 while
($rows = mysqli_fetch_assoc($resultset)){
100 $pdf->SetFont(
'Arial','',12);
101 $pdf->Ln();

102
103 foreach
($rows as $column) {
104 $pdf->Cell(
32,12,$column,1);
105 }
106 }

107
108
109 ///
Begin with regular font
110 $pdf->SetFont(
'Arial','',14);
111 $pdf->Write(
10,'Fee Payable ');
112 $pdf->Ln();
113 $pdf->Write(
10,'Paid ');
114 $pdf->Ln();
115 $pdf->Write(
10,'Balance ');
116 $pdf->Line(
0, 80, 210, 80); //Set the line
117
118 // Then put a blue underlined link

119 $pdf->SetTextColor(
0,0,255);
120 $pdf->SetFont(
'','U');
121 $pdf->Write(
10,'www.fpdf.org','http://www.fpdf.org');
122
123
124 // the position
is aboslute
125 $pdf->SetXY(
0, 50); // position of text1, numerical, of course, not x1 and y1
126 $pdf->Write(
0, 'Text1');
127
128
129
130 $pdf->Output();
131 ?>


Gõ tìm kiếm nhanh...